import request from '../../utils/request'
import axios from 'axios'

//查询登陆用户的菜单
export const findMenusList = () => {
  return axios({
    url: '/api/menu/getMenusByAdminId',
    method: 'get',
  })
}

// 查询菜单列表
export const getMenus = (menuVo) => {
  return axios({
    url: '/api/menu/getMenus',
    method: 'post',
    data:menuVo
  })
}

//获取所有菜单
export const getMenu = () => {
  return axios({
    url: '/api/menu/getMenus',
    method: 'get',
  })
}

// 查询菜下拉单列表
export const getMenuSelect = () => {
  return axios({
    url: '/api/menu/getMenuSelect',
    method: 'get',
  })
}

// 新增菜单
export function addMenu (menu) {
  return axios({
    url: '/api/menu/addMenu',
    method: 'post',
    data: menu
  })
}

// 修改菜单
export function updateMenu (menu) {
  return axios({
    url: '/api/menu/updateMenu',
    method: 'put',
    data: menu
  })
}

// 删除菜单
export function delMenu (menuId) {
  return axios({
    url: '/api/menu/delMenu',
    method: 'delete',
    params: {
      menuId,
    },
  })
}
